package com.vint.mi;

/**
 * 1.done
 * 2.easy
 * 求子二阶矩阵的对角线和最大值
 * 输入32位无符号数
 */
public class Mi39 {
    public static String solution(String line){
        String[] src = line.split(";");
        int m = src.length;
        int n = src[0].split(",").length;
        int[][] sa = new int[m][n];
        for(int i=0; i<m; i++){
            String[] s = src[i].split(",");
            for(int j=0; j<s.length;j++){
                sa[i][j] = Integer.parseInt(s[j]);
            }
        }
        return Integer.toString(maxLine(sa));
    }

    public static int maxLine(int[][] src){
        int m = src.length;
        int n = src[0].length;
        int sum  = 0;
        for(int i=0; i<m;i++){
            for(int j=0;j<n;j++){
                if(i+1<m&&j+1<n){
                    if(src[i][j]+src[i+1][j+1]>sum){
                        sum = src[i][j]+src[i+1][j+1];
                    }
                }
            }
        }
        return sum;
    }
    public static void main(String[] args) {
        System.out.println(solution("3,3,1,3,4;5,5,7,10,1;2,9,5,3,3"));
    }
}
